package com.androidx.p013lv.invention.adapter;

import android.content.Intent;
import android.net.Uri;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.alibaba.android.arouter.launcher.ARouter;
import com.androidx.p013lv.base.APPLink;
import com.androidx.p013lv.base.Constance;
import com.androidx.p013lv.base.bean.LabelVideoData;
import com.androidx.p013lv.base.glide.GlideUtils;
import com.androidx.p013lv.base.interfaces.Key;
import com.androidx.p013lv.base.service.AdClickService;
import com.androidx.p013lv.base.utils.SpUtils;
import com.androidx.p013lv.base.utils.TimeUtils;
import com.androidx.p013lv.base.utils.UiUtils;
import com.androidx.p013lv.invention.C1069R;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

/* renamed from: com.androidx.lv.invention.adapter.AdapterLabelVideoTwo */
public class AdapterLabelVideoTwo extends BaseQuickAdapter<LabelVideoData, BaseViewHolder> {
    private APPLink appLink;
    private boolean clickLimit = true;
    private long lastClickTime;

    public AdapterLabelVideoTwo() {
        super(C1069R.C1074layout.item_home_label, null);
    }

    /* access modifiers changed from: protected */
    public void convert(BaseViewHolder baseViewHolder, final LabelVideoData labelVideoData) {
        int i;
        int i2;
        LinearLayout linearLayout = (LinearLayout) baseViewHolder.getView(C1069R.C1072id.ll_root);
        LinearLayout linearLayout2 = (LinearLayout) baseViewHolder.getView(C1069R.C1072id.ll_empty);
        if (!labelVideoData.isEmpty()) {
            linearLayout.setVisibility(0);
            linearLayout2.setVisibility(8);
            TextView textView = (TextView) baseViewHolder.getView(C1069R.C1072id.tv_title);
            TextView textView2 = (TextView) baseViewHolder.getView(C1069R.C1072id.tv_score);
            TextView textView3 = (TextView) baseViewHolder.getView(C1069R.C1072id.tv_time);
            TextView textView4 = (TextView) baseViewHolder.getView(C1069R.C1072id.tv_subtitle);
            ImageView imageView = (ImageView) baseViewHolder.getView(C1069R.C1072id.iv_vip);
            ImageView imageView2 = (ImageView) baseViewHolder.getView(C1069R.C1072id.iv_xm);
            ImageView imageView3 = (ImageView) baseViewHolder.getView(C1069R.C1072id.iv_pay);
            ImageView imageView4 = (ImageView) baseViewHolder.getView(C1069R.C1072id.iv_original);
            ImageView imageView5 = (ImageView) baseViewHolder.getView(C1069R.C1072id.iv_cover);
            RelativeLayout relativeLayout = (RelativeLayout) baseViewHolder.getView(C1069R.C1072id.rl_content);
            RelativeLayout relativeLayout2 = (RelativeLayout) baseViewHolder.getView(C1069R.C1072id.rl_ad);
            TextView textView5 = (TextView) baseViewHolder.getView(C1069R.C1072id.tv_download);
            ViewGroup.LayoutParams layoutParams = relativeLayout.getLayoutParams();
            layoutParams.height = ((UiUtils.getWindowWidth() - UiUtils.dp2px(18)) * 9) / 16;
            relativeLayout.setLayoutParams(layoutParams);
            if (labelVideoData.getCoverImg() == null || labelVideoData.getCoverImg().size() <= 0 || TextUtils.isEmpty(labelVideoData.getCoverImg().get(0))) {
                GlideUtils.loadCropRadiusDefault(4, imageView5);
            } else {
                GlideUtils.loadCropRadiusWh2(SpUtils.getInstance().getString("domain") + labelVideoData.getCoverImg().get(0), 4, imageView5, Constance.BIG_PIC);
            }
            imageView5.setOnClickListener(null);
            if (labelVideoData.isAd()) {
                relativeLayout2.setVisibility(0);
                textView.setVisibility(8);
                textView2.setVisibility(8);
                textView3.setVisibility(8);
                imageView5.setOnClickListener(new View.OnClickListener() {
                    /* class com.androidx.p013lv.invention.adapter.AdapterLabelVideoTwo.View$OnClickListenerC11191 */

                    public void onClick(View view) {
                        if (!AdapterLabelVideoTwo.this.isOnClick()) {
                            if (labelVideoData.getAdInfoBean().getJumpType() == 2) {
                                try {
                                    Intent intent = new Intent();
                                    intent.setAction("android.intent.action.VIEW");
                                    intent.setData(Uri.parse(labelVideoData.getAdInfoBean().getAdJump()));
                                    view.getContext().startActivity(intent);
                                } catch (Exception e) {
                                    e.printStackTrace();
                                }
                            } else {
                                if (AdapterLabelVideoTwo.this.appLink == null) {
                                    AdapterLabelVideoTwo.this.appLink = new APPLink(view.getContext());
                                }
                                AdapterLabelVideoTwo.this.appLink.urlLink(labelVideoData.getAdInfoBean().getAdJump());
                            }
                            Intent intent2 = new Intent(view.getContext(), AdClickService.class);
                            intent2.putExtra("adId", labelVideoData.getAdInfoBean().getAdId());
                            view.getContext().startService(intent2);
                        }
                    }
                });
                textView5.setOnClickListener(new View.OnClickListener() {
                    /* class com.androidx.p013lv.invention.adapter.AdapterLabelVideoTwo.View$OnClickListenerC11202 */

                    public void onClick(View view) {
                        if (!AdapterLabelVideoTwo.this.isOnClick()) {
                            if (labelVideoData.getAdInfoBean().getJumpType() == 2) {
                                try {
                                    Intent intent = new Intent();
                                    intent.setAction("android.intent.action.VIEW");
                                    intent.setData(Uri.parse(labelVideoData.getAdInfoBean().getAdJump()));
                                    view.getContext().startActivity(intent);
                                } catch (Exception e) {
                                    e.printStackTrace();
                                }
                            } else {
                                if (AdapterLabelVideoTwo.this.appLink == null) {
                                    AdapterLabelVideoTwo.this.appLink = new APPLink(view.getContext());
                                }
                                AdapterLabelVideoTwo.this.appLink.urlLink(labelVideoData.getAdInfoBean().getAdJump());
                            }
                            Intent intent2 = new Intent(view.getContext(), AdClickService.class);
                            intent2.putExtra("adId", labelVideoData.getAdInfoBean().getAdId());
                            view.getContext().startService(intent2);
                        }
                    }
                });
            } else {
                imageView5.setOnClickListener(new View.OnClickListener() {
                    /* class com.androidx.p013lv.invention.adapter.AdapterLabelVideoTwo.View$OnClickListenerC11213 */

                    public void onClick(View view) {
                        if (!AdapterLabelVideoTwo.this.isOnClick()) {
                            ARouter.getInstance().build(Constance.VIDEO_PLAY_ACTIVITY).withSerializable(Key.VIDEO_ID, Integer.valueOf(labelVideoData.getVideoId())).navigation();
                        }
                    }
                });
                relativeLayout2.setVisibility(8);
                textView.setVisibility(0);
                textView2.setVisibility(0);
                textView3.setVisibility(0);
                textView.setText(labelVideoData.getTitle());
                textView2.setText(labelVideoData.getScore() + "分");
                textView3.setText(TimeUtils.stringForTime((long) (labelVideoData.getPlayTime() * 1000)));
            }
            imageView.setVisibility(8);
            imageView3.setVisibility(8);
            if (labelVideoData.getVideoType() == 1) {
                i = 0;
                imageView.setVisibility(0);
            } else {
                i = 0;
                if (labelVideoData.getVideoType() == 2) {
                    imageView3.setVisibility(0);
                }
            }
            if (labelVideoData.getVideoType() != 0 || labelVideoData.isAd()) {
                i2 = 8;
                imageView2.setVisibility(8);
            } else {
                imageView2.setVisibility(i);
                i2 = 8;
            }
            if (labelVideoData.getSelfMade()) {
                imageView4.setVisibility(i);
            } else {
                imageView4.setVisibility(i2);
            }
            textView4.setVisibility(i2);
            return;
        }
        linearLayout2.setVisibility(0);
        linearLayout.setVisibility(8);
    }

    public boolean isOnClick() {
        long currentTimeMillis = System.currentTimeMillis();
        long j = currentTimeMillis - this.lastClickTime;
        if (j > 1000) {
            this.lastClickTime = currentTimeMillis;
        }
        return !this.clickLimit ? j < 0 : j <= 1000;
    }
}
